﻿using Lhz.Sc.Business;
using Lhz.Sc.Entity.Database;
using Lhz.Test.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Lhz.Sc.Test.LhzScBusiness
{
    [TestClass]
    public class UnitTestLog
    {
        private ServiceProxy so = new ServiceProxy();
        private UserProxy uo = new UserProxy();

        [TestMethod]
        public void LogProxyTestMethodCommon()
        {
            var service = so.Query().First();
            var user = uo.Query().First();
            var log = TestEntityBuilder.BuildLog(user);
            var dbt = new ProxyCrudTester<Guid, Log>();
            var changes = new Dictionary<string, object>();
            var dt = DateTime.Now.AddMinutes(1);
            dt = DateTime.Parse(dt.ToString("yyyy-MM-dd hh:mm:ss"));
            changes.Add("Ip", "192.168.1.101");
            changes.Add("InvokeDatetime", dt);
            changes.Add("CompleteDatetime", dt.AddSeconds(1));
            changes.Add("InvokeResult", "InvokeResult");
            changes.Add("IsSuccess", false);
            dbt.CrudTest(log, log.Guid, changes, new string[] { "User" });
        }
    }
}
